#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
using namespace std;
#include <string>

class Person {
public:
	Person(int _a) {
		a = new int(_a);
	}
	int* a;
	Person& operator=(Person& p) {
		if (a != nullptr) {
			delete a;
			a = nullptr;
		}
		a = new int(*(p.a));
		return *this;
	}
};



int main05() {
	Person p1(10);
	Person p2(20);
	Person p3(300);
	p3 = p2 = p1;
	cout << *p1.a << endl;
	cout << *p2.a << endl;
	cout << *p3.a << endl;
	return 0;
}